﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Speech.Synthesis;//引用系统语音播报

namespace 课堂点名
{
    /// <summary>
    /// WindowView.xaml 的交互逻辑
    /// </summary>
    ///        

    public partial class WindowView : Window
    {
        public WindowView()
        {
            InitializeComponent();
      // 语音播报
     //       SpeechSynthesizer speech = new SpeechSynthesizer();
     //       speech.Speak("请，" + labelName.Content +"同学回答题目！");
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            dg.Items.Add(new DataGridRow(){ Item = new { Col1 = "1", Col2 = labelName.Content, Col3 = "错误" } });
            SpeechSynthesizer speech = new SpeechSynthesizer();
            speech.Speak(labelName.Content + "同学回答错误！");
        }

        private void buttonOK_Click(object sender, RoutedEventArgs e)
        {
            dg.Items.Add(new DataGridRow() { Item = new { Col1 = "1", Col2 = labelName.Content, Col3 = "正确" } });
            SpeechSynthesizer speech = new SpeechSynthesizer();
            speech.Speak(labelName.Content + "同学回答正确！");
           
        }

        private void dg_GotFocus(object sender, RoutedEventArgs e)
        {
            MessageBox.Show(dg.ToString());
        }
    }
}
